import { createStore } from 'redux'
import { actionType } from '../interface'

const reducer = (state:any, action:actionType) => {
    const { type, data } = action

    if (type === 'CHANGE_LIST') {
        return {
            ...state,
            list: data
        }
    }
    return state
}

const initalState = {
    // 分类列表的数据
    list: []
}

const store = createStore(reducer, initalState)

// 仓库中所有的参数类型
export type RootStore = ReturnType<typeof store.getState>

export default store
